﻿using Microsoft.AspNetCore.Mvc;
using Serilog;
using Worldme.YHChatSDK.Common.Vo;
using Worldme.YHChatSDK.Framework.Core;
using Worldme.YHChatSDK.Framework.Vo;

namespace Worldme.YHChatSDK.Framework.Controller
{
    [ApiController]
    [Route("/yhchat/event")]
    public class EventController : ControllerBase
    {
        [HttpPost]
        [Route("msg")]
        public Result Message([FromBody] EventMsgVo eventMsgVo)
        {
            Log.Information("【YHChatSDK】接收到来自IP[{IP}]的请求消息：{EventType}，原始消息为{EventMessage}", HttpContext.Connection.RemoteIpAddress.MapToIPv4(), eventMsgVo.header.eventType, eventMsgVo.ToString());
            GlobalExecutorSubmit.Submit(eventMsgVo);
            return Result.Ok();
        }
    }
}
